package display;

import java.awt.Panel;
import java.awt.TextField;
import client.CmdHandler;
import interfaces.IDisplayGaugeGui;
import it.unibo.is.interfaces.IBasicEnvAwt;

/**
 * @author Stefano&Davide
 * @version 1.0
 */

public class DisplayGuiOdometer  extends DisplayOdometer implements IDisplayGaugeGui{
	
	protected Panel panel;
	protected TextField tarea;
	protected CmdHandler handler;
	
	public DisplayGuiOdometer(IBasicEnvAwt env){
		super(env);
	}

	@Override
	protected void configure() {
		tarea=new TextField("000000");
		tarea.setFocusable(false);
		panel=new Panel();
		tarea.setFont(new java.awt.Font("Arial",java.awt.Font.BOLD,24));
		panel.add(tarea);
		env.addPanel(panel);
	}

	@Override
	protected void showVal(String v) {
		tarea.setText(v);		
	}

	public void setHandler(CmdHandler hand){
		handler=hand;
		String[] commands={"Inc"};
		env.addCmdPanel("Cmd", commands,handler);
	}

	public String getCurValGaugeDisplayed() {
		return tarea.getText();
	}
}
